<template>
	<view>
		<view style="width: 750rpx;height: 1rpx;background-color: #D8D8D8;"></view>
		<view style="width: 750rpx;height: 400rpx;position: relative;">
			<textarea style="width: 670rpx;height: 294rpx;margin-left: 30rpx;margin-top: 40rpx;font-size: 34rpx;" placeholder="*请输入隐患整改详情…" placeholder-style="color:#CCCCCC;font-size:34rpx" @input="inputs" maxlength="200" v-model="dateinfo"></textarea>
			<view style="bottom: 40rpx;right: 30rpx;font-size: 24rpx;position: absolute;color: #999999;">{{start}}/200</view>
			<view style="width: 720rpx;height: 1rpx;margin-left: 30rpx;bottom: 0;position: absolute;background-color: #E5E5E5;"></view>
		</view>
		<view>
			<view style="font-size: 34rpx;line-height: 34rpx;margin-top: 40rpx;margin-left: 30rpx;">可上传照片(1-4张)</view>
			<view>
				<view style="width: 180rpx;height: 180rpx;background-color: #F5F5F8;margin-top: 30rpx;margin-left: 30rpx;border-radius: 8rpx;" v-if="imgArr.length==0">
					<image src="../../static/btn_takephoto@3x.png" style="width: 88rpx;height: 88rpx;margin-top: 46rpx;margin-left: 46rpx;" @click="uploadImg" ></image>
				</view>
				<view v-else style="margin-left: 10rpx;">
					<view style="width:180rpx;height: 180rpx ;position: relative;margin-left: 20rpx;margin-top: 30rpx;float: left;" v-for="(item,index) in imgArr">
						<image  :src="item" style="width: 180rpx;height: 180rpx; position: absolute;"></image>
						<image  src="../../static/btn_delete@3x.png" style="position: absolute;width: 40rpx;height: 40rpx;right: -20rpx;top: -20rpx;" @click="deletes(index)"></image>
					</view>	
				</view>	
			</view>
		</view>
		<view style="width: 750rpx;height: 120rpx; position: fixed;bottom: 0;border-top: 1prx solid #E5E5E5;" v-if="start==0||imgArr.length==0">
			<button style="background-color: rgba(81, 154, 255, 0.29);color: #FFFFFF;width: 690rpx;height: 94rpx;border-radius: 47rpx;font-size: 36rpx;margin-left: 32rpx;margin-top: 14rpx;" disabled="true">提交整改</button>
		</view>
		<view style="width: 750rpx;height: 120rpx; position: fixed;bottom: 0;border-top: 1prx solid #E5E5E5;" v-else>
			<button style="background-color: rgba(81, 154, 255, 1);color: #FFFFFF;width: 690rpx;height: 94rpx;border-radius: 47rpx;font-size: 36rpx;margin-left: 32rpx;margin-top: 14rpx;">提交整改</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				start:0,
				dateinfo:'',
				imgArr:[]
			}
		},
		methods: {
			inputs(){
				let tetVal=this.dateinfo.length
				this.start=tetVal
				
			},
			uploadImg(){
				let that = this
				uni.chooseImage({
					count:4,
					success(res) {
						console.log(that.imgArr.length);
						that.imgArr=res.tempFilePaths;
						console.log(that.imgArr);
					}
					
				})
			},
			deletes(index){
				console.log(index);
				this.imgArr.splice(index,1)
			}
		}
	}
</script>

<style>

</style>
